package com.k.lib_base

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

open class BaseViewModel : ViewModel() {
    val loadStauts = MutableLiveData<LoadStauts>()

    var message = ""

    fun success(message: String) {
        this.message = message
        loadStauts.value = LoadStauts.SUCCESS
    }


    fun loading(message: String) {
        this.message = message
        loadStauts.value = LoadStauts.LOADING
    }

    fun error(message: String) {
        this.message = message
        loadStauts.value = LoadStauts.ERROR
    }

    fun tip(message: String) {
        this.message = message
        loadStauts.value = LoadStauts.TIP
    }

    fun successPost(message: String) {
        this.message = message
        loadStauts.postValue(LoadStauts.SUCCESS)
    }


    fun loadingPost(message: String) {
        this.message = message
        loadStauts.postValue(LoadStauts.LOADING)
    }

    fun errorPost(message: String) {
        this.message = message
        loadStauts.postValue(LoadStauts.ERROR)
    }

    fun tipPost(message: String) {
        this.message = message
        loadStauts.postValue(LoadStauts.TIP)
    }

    enum class LoadStauts {
        LOADING,
        SUCCESS,
        ERROR,
        TIP
    }
}